package com.bwie.controller;

import com.bwie.pojo.TbGroupActive;
import com.bwie.service.TbGroupActiveService;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @description : 拼团活动
 * @Author QiHainan
 * @Create 2025/7/27 13:58
 * @Version 1.0
 */
@RestController
@RequestMapping("/team/index")
public class IndexController {
    @Autowired
    TbGroupActiveService tbGroupActiveService;

    /**
     * 获取拼团活动分页列表
     * @param pageInfoVo
     * @return
     */
    @PostMapping("/getGroupActivePage")
    public R getGroupActivePage(@RequestBody PageInfoVo pageInfoVo){
        return tbGroupActiveService.getGroupActivePage(pageInfoVo);
    }

    /**
     * 添加拼团活动
     * @param tbGroupActive
     * @return
     */
    @PostMapping("/addGroupActive")
    public R addGroupActive(@RequestBody TbGroupActive tbGroupActive){
        return tbGroupActiveService.addGroupActive(tbGroupActive);
    }

    /**
     * 修改拼团活动信息
     * @param tbGroupActive
     * @return
     */
    @PostMapping("/updateGroupActive")
    public R updateGroupActive(@RequestBody TbGroupActive tbGroupActive){
        return tbGroupActiveService.updateGroupActive(tbGroupActive);
    }

    /**
     * 根据ID删除拼团活动
     * @param activeId
     * @return
     */
    @PostMapping("/deleteGroupActive/{activeId}")
    public R deleteGroupActive(@PathVariable("activeId") Integer activeId){
        return tbGroupActiveService.deleteGroupActive(activeId);
    }
}
